package text5;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class Grid extends JFrame{
    public Grid(){
        GridLayout();
        frame();
        this.setVisible(true);
    }
    public void frame(){
        this.setTitle("GridLayout");
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(2);
        this.setAlwaysOnTop(true);
        this.getContentPane().setLayout(new GridLayout(6,6,10,10));
        this.pack();
    }
    public void GridLayout(){
        for (int j = 0; j < 6; j++) {
        for (int i = 0; i < 6; i++) {
            this.add(new JLabel("标签" + (j+1)*(i+1)));
            this.add(new JButton("按钮" + (j+1)*(i+1)));
            }
        }
    }
}

public class Num3 {
    public static void main(String[] args) {
        Grid grid = new Grid();
//        Border border = new Border();
//        Flow flow = new Flow();
//        Grid grid = new Grid();
    }
}
